package trade.axht.controller;

import java.util.List;

import org.apache.ibatis.mapping.ResultMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import trade.axht.entity.TbUser;
import trade.axht.service.IUserService;

@Controller
public class UserController {
	@Autowired
	private IUserService userService;
	
	@RequestMapping("/showUser/{id}")
	public String toIndex(@PathVariable(value="id") Integer id,Model model){
		List<TbUser> user=userService.getUserAll();
		model.addAttribute("user",user);
		return "UserInfo";
		
	}
	@RequestMapping("/showUser")
	@ResponseBody
	public ModelMap testJson(){
		List<TbUser> users=userService.getUserAll();
		ModelMap md=new ModelMap();
		md.addAttribute("users",users);
		return md;
	}
	@RequestMapping("/testshowUser")
	@ResponseBody
	public ModelMap test53aaaJson(){
		List<TbUser> users=userService.getUserAll();
		ModelMap md=new ModelMap();
		md.addAttribute("users",users);
		return md;
	}
}
